﻿using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL
{
    public class FangXing_DAL
    {
        public FangXing_DAL(Context context)
        {
            Context = context;
        }

        public Context Context { get; }

        /// <summary>
        /// 房型添加
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public int FXAdd(FangXing_Model m)
        {
            var  m1=Context.FangXing_Model.FirstOrDefault(x=>x.FXName==m.FXName);

            if(m1!=null)
            {
                return -1;
            }
            else
            {
                Context.FangXing_Model.Add(m);
                return Context.SaveChanges();
            }
        }



    }
}
